<template>
  <div >
      <view>
        <view style='width: 100%;  height: 1rpx' />
        <i-row class="header-row">
          <i-col span="6" i-class="col-class">
            <view class="table_parent">单号</view>
          </i-col>
          <i-col span="6" i-class="col-class">
            <view class="table_parent">时间</view>
          </i-col>
          <i-col span="3" i-class="col-class">
            <view class="table_parent">状态</view>
          </i-col>
          <i-col span="3" i-class="col-class">
            <view class="table_parent">快递号</view>
          </i-col>
          <i-col span="6" i-class="col-class">
            <view class="table_parent">果品</view>
          </i-col>


        </i-row>
        <view class="block-order" style='width: 100%;  height: 1rpx;' />
        <block   v-for="(item, index) in orderlist"  :key="index" >
          <i-row class="row-order" @tap="goInfo(item._id)">
            <i-col span="6" i-class="col-class">
              <view class="table_parent min">{{item.num}}</view>
            </i-col>
            <i-col span="6" i-class="col-class">
              <view class="table_parent">{{item.addtime}}</view>
            </i-col>
            <i-col span="3" i-class="col-class">
              <view class="table_parent">{{item.state}}</view>
            </i-col>
            <i-col span="3" i-class="col-class">
              <view class="table_parent">{{item.express}}</view>
            </i-col>
            <i-col span="6" i-class="col-class">
              <view class="table_parent">{{item.guopin}}<br/>{{item.guige}}</view>
            </i-col>


          </i-row>
        </block>
      </view>

  </div>
</template>

<script>
  import {orderListText} from '../../api/basisMG'

  export default {
  data () {
    return {
      orderlist:[]

    }
  },
  beforeMount(){
    wx.getUserInfo({
      success:(data)=>{
        console.log(data)
      }
    })



    },

  onShow() {
    this.rowdata()
  },

    mounted() {
//      this.rowdata()
  },
  methods: {
    rowdata(){
      let t = this
      this.username = wx.getStorageSync('loginInfo').username
      orderListText({"query":{
        username:this.username,
        deltime:null
      }}).then(res => {
            t.orderlist = res.data
        }
      )
    },

    goInfo(d){
      console.log(d)
      wx.navigateTo({
        url: "/pages/order_info/main?id="+d
      })

    },

    changeUsername(data){
      this.username = data.mp.detail
    },
    changepassword(data){
      this.password = data.mp.detail
    },
    getUserInfo(data){
      if(data.mp.detail.rawData){
        wx.getUserInfo({
          success:(data)=>{
            console.log(data)
            this.userInfo = data.userInfo
          }
        })
      }
    },
    bindViewTap () {
      const url = '../logs/main'
      if (mpvuePlatform === 'wx') {
        mpvue.switchTab({ url })
      } else {
        mpvue.navigateTo({ url })
      }
    },
    clickHandle (ev) {
      console.log('clickHandle:', ev)
      // throw {message: 'custom test'}
    }
  }
}
</script>

<style >
.min.table_parent{
  font-size: .8em;
}

  .block-order{
    margin-top: 95rpx;
  }

  .header-row{
    position: fixed;
    width: 100%;
    line-height: 2;
    margin-top: -1rpx;
    border-bottom: 1rpx solid #ccc;
  }


  .row-order{
    line-height: 2;
  }

  .row-order .van-row{
    border-bottom: 1rpx solid #eee;
  }

page {
  background-color: #fff;
}

  .table_parent {
    display:flex;
    justify-content:center;
    align-items:center;
    background: white;
    font-size:30rpx;
    text-align:center;
    box-sizing:border-box;
    color:#595a5e;
    padding-top: 20rpx;
    padding-bottom: 20rpx;
  }
  .table {
    border: 1px solid #dadada;
    border-right: 0;
    border-bottom: 0;
    width: 98%;
  }

  .tr {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .th, .td {
    padding: 10px;
    border-bottom: 1px solid #dadada;
    border-right: 1px solid #dadada;
    text-align: center;
    width: 100%;
  }

  .th {
    font-weight: 400;
    background-color: #dadada;
  }

</style>
